package study01;

import java.util.Random;
import java.util.Scanner;

public class Exercise01 {
    public static void main(String[] args) {
        String name = "xiaoming";
        String password = "1234aa";
        Scanner scanner = new Scanner(System.in);
        for (int i = 1; i <4 ; i++) {
            System.out.println("请输入用户名：");
            String str = scanner.nextLine();
            System.out.println("请输入密码：");
            String str2 = scanner.nextLine();
            if (str.equals(name) && str2.equals(password)){
                System.out.println("登录成功！");
                break;
            }else{
                if (i==3){
                    System.out.println("你的账户被锁定，请联系管理员");
                }else{
                    System.out.println("登录失败！，您还有" + (3-i) + "次机会");
                }

            }
        }
    }
}
